const Preload = require("./preload");
class Overs extends Preload {
  constructor() {
    super();
    this.fireTime = (Math.random() * 2000)+3000;
    this.fires = null;
  }
  setFire() {
    this.fires = game.add.sprite(this.cx, this.cy, "fires");
    // this.scales(this.fires);
    this.fires.width=this.fires.width*2/3;
    this.fires.height=this.fires.height*2/3;
    this.fires.anchor.setTo(0.5, 0.5);
    this.fires.animations.add("fires", [0, 1, 2, 3], 6).play("fires", true, true);
  }
  create() {
    let bg = game.add.image(0, 0, "bg_over");
    bg.width = this.bw;
    bg.height = this.bh;
    this.setFire();
    setTimeout(() => {
      this.finishGame();
    }, this.fireTime);

  }
  finishGame() {
    console.log("game finished");
    
    window.__gameFinished();
  }
}
module.exports = Overs;
